home *** CD-ROM | disk | FTP | other *** search
- VERSION 2.00
- Begin Form Strings
- BackColor = &H00C0C0C0&
- Caption = "Strings & Files"
- ClientHeight = 4650
- ClientLeft = 1665
- ClientTop = 3465
- ClientWidth = 7215
- Height = 5055
- Left = 1605
- LinkTopic = "Form1"
- ScaleHeight = 4650
- ScaleWidth = 7215
- Top = 3120
- Width = 7335
- Begin CommandButton cmdString
- Caption = "Build outside Loop"
- Height = 450
- Index = 1
- Left = 120
- TabIndex = 1
- Top = 1320
- Width = 1900
- End
- Begin TextBox txtCount2
- Height = 280
- Left = 5700
- TabIndex = 5
- Text = "1000"
- Top = 2520
- Width = 1400
- End
- Begin CommandButton cmdFiles
- Caption = "Binary"
- Height = 450
- Index = 1
- Left = 120
- TabIndex = 3
- Top = 3840
- Width = 1900
- End
- Begin CommandButton cmdFiles
- Caption = "Random"
- Height = 450
- Index = 0
- Left = 120
- TabIndex = 2
- Top = 3120
- Width = 1900
- End
- Begin CommandButton cmdString
- Caption = "Build in Loop"
- Default = -1 'True
- Height = 450
- Index = 0
- Left = 120
- TabIndex = 0
- Top = 660
- Width = 1900
- End
- Begin TextBox txtCounter
- Height = 280
- Left = 5700
- TabIndex = 4
- Text = "txtCounter"
- Top = 120
- Width = 1400
- End
- Begin Label lblFiles
- BackStyle = 0 'Transparent
- Caption = "00.00 secs"
- FontBold = -1 'True
- FontItalic = 0 'False
- FontName = "MS Sans Serif"
- FontSize = 9.75
- FontStrikethru = 0 'False
- FontUnderline = 0 'False
- ForeColor = &H00800000&
- Height = 280
- Index = 1
- Left = 5700
- TabIndex = 8
- Top = 3840
- Width = 1400
- End
- Begin Label lblFiles
- BackStyle = 0 'Transparent
- Caption = "00.00 secs"
- FontBold = -1 'True
- FontItalic = 0 'False
- FontName = "MS Sans Serif"
- FontSize = 9.75
- FontStrikethru = 0 'False
- FontUnderline = 0 'False
- ForeColor = &H00800000&
- Height = 280
- Index = 0
- Left = 5700
- TabIndex = 10
- Top = 3120
- Width = 1400
- End
- Begin Label Label2
- BackStyle = 0 'Transparent
- Caption = "Read && Write records using Binary I/O"
- Height = 450
- Left = 2150
- TabIndex = 13
- Top = 3840
- Width = 3100
- End
- Begin Label Label1
- BackStyle = 0 'Transparent
- Caption = "Read && Write records using Random access"
- Height = 450
- Index = 4
- Left = 2150
- TabIndex = 15
- Top = 3120
- Width = 3100
- End
- Begin Label lblTitle
- AutoSize = -1 'True
- BackStyle = 0 'Transparent
- Caption = "File I/O"
- FontBold = -1 'True
- FontItalic = 0 'False
- FontName = "MS Sans Serif"
- FontSize = 12
- FontStrikethru = 0 'False
- FontUnderline = 0 'False
- ForeColor = &H00800000&
- Height = 300
- Index = 2
- Left = 120
- TabIndex = 14
- Top = 2400
- Width = 1875
- End
- Begin Line Line2
- BorderColor = &H00808080&
- X1 = 0
- X2 = 7335
- Y1 = 2100
- Y2 = 2100
- End
- Begin Label Label1
- BackStyle = 0 'Transparent
- Caption = "Copy the strings to a temp Variable, then copy temp to new Variable"
- Height = 450
- Index = 3
- Left = 2145
- TabIndex = 12
- Top = 1320
- Width = 3105
- End
- Begin Label Label1
- BackStyle = 0 'Transparent
- Caption = "Explicitly copy strings to the new Variable"
- Height = 450
- Index = 2
- Left = 2150
- TabIndex = 11
- Top = 660
- Width = 3100
- End
- Begin Label lblString
- BackStyle = 0 'Transparent
- Caption = "00.00 secs"
- FontBold = -1 'True
- FontItalic = 0 'False
- FontName = "MS Sans Serif"
- FontSize = 9.75
- FontStrikethru = 0 'False
- FontUnderline = 0 'False
- ForeColor = &H00800000&
- Height = 280
- Index = 0
- Left = 5700
- TabIndex = 9
- Top = 660
- Width = 1400
- End
- Begin Label lblString
- BackStyle = 0 'Transparent
- Caption = "00.00 secs"
- FontBold = -1 'True
- FontItalic = 0 'False
- FontName = "MS Sans Serif"
- FontSize = 9.75
- FontStrikethru = 0 'False
- FontUnderline = 0 'False
- ForeColor = &H00800000&
- Height = 280
- Index = 1
- Left = 5700
- TabIndex = 7
- Top = 1320
- Width = 1400
- End
- Begin Label lblTitle
- AutoSize = -1 'True
- BackStyle = 0 'Transparent
- Caption = "Strings"
- FontBold = -1 'True
- FontItalic = 0 'False
- FontName = "MS Sans Serif"
- FontSize = 12
- FontStrikethru = 0 'False
- FontUnderline = 0 'False
- ForeColor = &H00800000&
- Height = 300
- Index = 1
- Left = 120
- TabIndex = 6
- Top = 60
- Width = 1875
- End
- Begin Line Line1
- BorderColor = &H00FFFFFF&
- BorderWidth = 2
- Index = 0
- X1 = 0
- X2 = 7335
- Y1 = 2115
- Y2 = 2115
- End
- 'Const Temp = "Begin String......End String"
- Sub cmdFiles_Click (Index As Integer)
- 'Use Binary instead of Random File I/O"
- On Error Resume Next
- Dim allrecs() As BookAuthor
- ReDim allrecs(txtCount2)
- Me.MousePointer = 11
- For x = 1 To txtCount2
- allrecs(x).ID = x
- allrecs(x).Name = "John Doe - Generic Person"
- Next x
- Kill App.Path & "\" & "files.out"
- If Index = 0 Then
- Open App.Path & "\" & "files.out" For Random As #1
- Else
- Open App.Path & "\" & "files.out" For Binary As #1
- End If
- Start# = Timer
- For x = 1 To txtCount2
- Put #1, , allrecs(x)
- Next x
- Seek #1, 1
- For x = 1 To txtCount2
- Get #1, , allrecs(x)
- Next x
- Finish# = Timer
- lblfiles(Index) = Format(Finish# - Start#, "##.##") & " secs."
- Close #1
- Me.MousePointer = 0
- End Sub
- Sub cmdString_Click (Index As Integer)
- strfirst$ = "Really long String. "
- strsecond$ = "Next really long string. "
- strthird$ = "I mean this is going to be a really long one!"
- MousePointer = 11
- If Index = 0 Then
- Start# = Timer
- For x = 1 To txtCounter
- result$ = strfirst$ & strsecond$ & strthird$
- Next x
- Finish# = Timer
- Else
- Temp$ = strfirst$ & strsecond$ & strthird$
- Start# = Timer
- For x = 1 To txtCounter
- result$ = Temp$
- Next x
- Finish# = Timer
- End If
- lblString(Index) = Format$(Finish# - Start#, "##.##") & " secs."
- MousePointer = 0
- End Sub
- Sub Form_Load ()
- ' Center the form
- Me.Left = (screen.Width - Me.Width) / 2
- Me.Top = (screen.Height - Me.Height) / 2
- txtCounter = 10000
- txtCount2 = 1000
- End Sub
-